Skip to content

Convert notification-permission to a Kotlin Multiplatform module - #3365

Closed
StylianosGakis wants to merge 2 commits into
developfrom
refactor/kmp-notification-permission
Closed

StylianosGakis wants to merge 2 commits into
developfrom
refactor/kmp-notification-permission

Conversation

@StylianosGakis

Copy link
Copy Markdown
Member
🤖 AI description

Turns notification-permission into a Kotlin Multiplatform module (JVM and Android targets), so the feature modules that use it can move to commonMain later. Part of making the whole app run on a second platform (desktop).

This is not a pure move. NotificationPermissionState used to extend Accompanist's PermissionState, which cannot live in commonMain. It is now a project-owned interface with the same member names, and the Android implementation wraps Accompanist behind it. The launcher, the lifecycle checker and the dialog trigger are the same code in the same order, and status still reads Accompanist's snapshot state on every access.

Four call sites change one import package each. The first commit is a pure rename, review the second.

On the JVM target the permission reads as not granted and no dialog is shown.

Worth a manual check before merge: the notification permission prompt and its denied dialog on a device.

The module now has JVM and Android targets. NotificationPermissionState,
NotificationPermissionDialog and the preview state are declared in
commonMain. The state no longer extends Accompanist's PermissionState:
it has the same member names (permission, status, launchPermissionRequest)
and a project-owned PermissionStatus with isGranted and
shouldShowRationale extensions, so call sites only swap the import
package of those symbols.

The Android actual is the existing Accompanist implementation, adapting
its status to the new type. The JVM actual reads as denied, never shows
a dialog and ignores requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant